package org.czx.datactruct.fifth;

/**
 * @author czx
 * @date 2020/9/5 16:23
 */
public interface StackInterface<T> {
    /**
     * 压栈
     *
     * @param newEntry
     */
    void push(T newEntry);

    /**
     * 弹出
     *
     * @return
     */
    T pop();

    /**
     * Retrieves this stack's top entry.
     *
     * @return either the object at the top of the stack or null if
     * the stack is empty
     */
    T peek();

    /**
     * Detects whether this stack is empty.
     *
     * @return true if the stack is empty
     */
    boolean isEmpty();

    /**
     * Removes all entries from this stack.
     */
    void clear();
}
